<template>
    <el-row>
        <div>
            <el-button type="info" @click="pushPermissions">部门</el-button>
            <el-button type="info">添加部门</el-button>
        </div>
        <div>
            <el-dialog title="新增部门" :visible.sync="dialogFormVisible">
            <el-form :model="form">
                <div class="headertwo_three">
                    <h5>上级部门</h5>
                    <template>
                        <el-select v-model="tableData3Name" placeholder="全部">
                            <el-option
                            v-for="(item,index) in tableData3"
                            :key="index"
                            :label="item.value"
                            :value="item.depart_p_id">
                            </el-option>
                        </el-select>
                    </template>
                </div>
                <div class="headertwo_two">
                <h4>
                        部门名称:
                    </h4>
                    <div>
                        <el-input
                            placeholder="部门名称"
                            v-model="depart_name"
                            clearable>
                        </el-input>
                    </div>
                </div>
                <div class="headertwo_two">
                        <h5>领导</h5>
                        <template>
                            <el-select v-model="tableData4Name" placeholder="全部">
                                <el-option
                                v-for="(item,index) in tableData4"
                                :key="index"
                                :label="item.value"
                                :value="item.role_dep_id">
                                </el-option>
                            </el-select>
                        </template>
                    </div>
                    <div class="headertwo_two">
                        <h5>角色</h5>
                        <template>
                            <el-select v-model="tableData4Name" placeholder="全部">
                                <el-option
                                v-for="(item,index) in tableData4"
                                :key="index"
                                :label="item.value"
                                :value="item.role_id">
                                </el-option>
                            </el-select>
                        </template>
                    </div>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible1()">取 消</el-button>
                <el-button type="primary" @click="dialogFormVisible2()">确 定</el-button>
            </div>
            </el-dialog>
        </div>
    </el-row>
</template>

<script>

export default {
    name:'Department',
    data() {
        return {
            dialogFormVisible: true,
            form: {
                depart_name: '',
                role_dep_id:'',
                depart_p_id:'',
                roleList:[{
                    role_id:''
                }]
            },
            formLabelWidth: '120px',
            tableData3:[],
            tableData4:[],
            tableData3Name:'',
            tableData4Name:'',
            }
    },
    methods: {
        pushPermissions(){
            this.$router.push({
               name:'权限设置',
               path:'/Home/Homemin/Permissions',
               query: {
                  
                    },
          })
        },
        dialogFormVisible1(){
            this.$router.push({
               name:'权限设置',
               path:'/Home/Homemin/Permissions',
               query: {
                  
                    },
          })
        },
        dialogFormVisible2(){
            this.$router.push({
               name:'权限设置',
               path:'/Home/Homemin/Permissions',
               query: {
                  
                    },
          })
        },
        getallRole1(){
            this.axios({
                method:'get',
                url:'http://172.16.10.84:8080/role/findRoleName',
            }).then((data)=>{
                console.log(data);
                this.tableData4 =data.data.data
                // console.log(this.tableData4);
            })
        },
         getallRole2(){
            this.axios({
                method:'get',
                url:'http://172.16.10.84:8080/role/findRoleName',
            }).then((data)=>{
                console.log(data);
                this.tableData5 =data.data.data
                // console.log(this.tableData4);
            })
        },
        getallDepart1(){
            this.axios({
                method:'get',
                url:'http://172.16.10.84:8080/depart/findSuperDeptName',
            }).then((data)=>{
                this.tableData3 =data.data.data
                // console.log(data);
                // console.log( this.tableData3);
            })
        },
    },
    created(){
        this.activeName=this.$store.state.Department.activeName,
        this.getallRole1()
        this.getallDepart1()
    },    
}
</script>

<style lang='less' scoped>

</style>